const express = require("express");
const compression = require("compression");
const path = require("path");
const fs = require("fs");

const app = express();

// 对传递文件做gzip的压缩处理
app.use(compression());

app.get("/", (req, res) => {
    let fileContent = fs.readFileSync(path.join(__dirname, "/start/index.html"));
    res.writeHead(200, { "Content-Type": "text/html" });
    res.end(fileContent);
});

app.listen(8081);

// 指名目录
app.use(express.static(path.join(__dirname, "/start")));
